home *** CD-ROM | disk | FTP | other *** search
- Path: castle.nando.net!news
- From: actuary@nando.net (Bill McCarthy)
- Newsgroups: comp.lang.c
- Subject: Re: Calculation in C: HELP
- Date: 28 Jan 1996 17:45:04 GMT
- Organization: News & Observer Public Access
- Message-ID: <4egcn0$bta@castle.nando.net>
- References: <4eddjd$mde@newsbf02.news.aol.com>
- Reply-To: actuary@nando.net (Bill McCarthy)
- NNTP-Posting-Host: vyger713.nando.net
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4eddjd$mde@newsbf02.news.aol.com>,
- queenhead@aol.com (Queenhead) writes:
-
- >Hi. I am trying to use the following calculation in a program and it is
- >not coming out right:
- >
- >nextyr = rate * currentyr * ( 1 - (currentyr/1000000)
- >
- >Is something wrong with that (in terms of C syntax)? I should be getting
- >234,000 if rate is 2.6 and currentyr is 100,000. My program is not
- >giving me that.
-
- You should post small complete code. That line above should produce
- a syntax error, since its missing a ");" at the end.
-
- Assuming your variables are all declared doubles and ints are 32 bit,
- your line of code should work fine. If ints are 16 bit, then 1000000
- will not fit (you could add an "L" if it fits in long, or add a "." to make
- it a double).
-
- Bill McCarthy
- actuary@nando.net
- Wendell, NC USA
-
-